/*
 * @Author: your name
 * @Date: 2021-10-29 15:46:55
 * @LastEditTime: 2022-06-01 10:33:49
 * @LastEditors: 夏郑兴 971348024@qq.com
 * @Description: 用户分析
 */
import request from '@/utils/system/request'

/**
 * 管理员列表
 * page	integer
 * pageSize	integer
 **/
export function getSystemAdminList() {
  return request({
    url: '/admin/system_admin/list',
    baseURL: '/api',
    method: 'get',
  })
}

/**
 * 新建管理员
 * action_permissions array[string] 操作权、 "0" 全部权限 1查看权限 2上传权限 3 下载权限
 * admin_type integer
 * pass_word string
 * project_permissions array[string] 项目权限
 * status integer
 * team_permissions array[string] 团队权限
 * user_name string
 **/
export function createSystemAdmin(data: object) {
  return request({
    url: '/admin/system_admin/created',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 管理员列表
 * id
 * action_permissions array[string] 操作权、 "0" 全部权限 1查看权限 2上传权限 3 下载权限
 * admin_type integer
 * pass_word string
 * project_permissions array[string] 项目权限
 * status integer
 * team_permissions array[string] 团队权限
 * user_name string
 **/
export function editSystemAdmin(data: any) {
  return request({
    url: '/admin/system_admin/edit',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 删除管理员账号
 * id
 **/
export function delSystemAdmin(data: any) {
  return request({
    url: '/admin/system_admin/del',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 编辑管理员的状态
 * id
 * status
 **/
export function changeAdminStatus(data: any) {
  return request({
    url: '/admin/system_admin/change_status',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 获取管理员信息
 **/
export function getAdminInfo() {
  return request({
    url: '/admin/system_admin/info',
    baseURL: '/api',
    method: 'get',
  })
}



/**
 * 更新管理员密码
 * new_pass_word string
 * ole_pass_word string
 **/
export function changePassword(data: any) {
  return request({
    url: '/admin/system_admin/change_password',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 批量导入通用接口处理
 * file
 **/
export function batchImportReq(data: any, formData: any) {
  return request({
    url: data.url,
    baseURL: '/api',
    method: 'post',
    data: formData
  })
}

/**
 * 批量导入用户
 * file
 **/
export function batchImportUser(data: any) {
  return request({
    url: '/admin/user/excel/imports',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function batchExportUser(data: any) {
  return request({
    url: '/admin/user/batch_export_user',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 批量更新用户
 * file
 **/
export function batchUpdateUser(data: any) {
  return request({
    url: '/admin/user/excel/batch_update',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 用户列表
 **/
export function getUserList(data: any) {
  return request({
    url: '/admin/user/list',
    baseURL: '/api',
    method: 'post',
    data
  })
}
export function userBatchDel(data: any) {
  return request({
    url: '/admin/user/batch_del',
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 项目权限或团队权限id列表
 * search_text string
 * tp 0：项目 1：团队
 */
export function getAuthList(data: any) {
  return request({
    url: `/admin/ids/list`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 用户题量
 * real_name string
 * status integer
 * team_number string
 * user_get_date_time string
 * user_id string
 */
export function getTopicQuantity(data: any) {
  return request({
    url: `/admin/user/topic_quantity`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 用户项目分析
 * get array[integer]
 * give_up array[integer]
 * page integer
 * page_size integer 
 * real_name string
 * registration_date
 * array[string]
 * team_number string
 * upload_rate number
 */
export function getProjectAnalysis(data: any) {
  return request({
    url: `/admin/user/project_analysis`,
    baseURL: '/api',
    method: 'post',
    data
  })
}

/**
 * 用户项目分析导出
 * get array[integer]
 * give_up array[integer]
 * real_name string
 * registration_date array[string]
 * team_number string
 * upload_rate number 
 * user_project_ids array[string]
 */
export function exportProjectAnalysis(data: any) {
  return request({
    url: `/admin/user/project_analysis/export`,
    baseURL: '/api',
    method: 'post',
    data
  })
}


export function userBalanceDetail(data: any) {
  return request({
    url: `/admin/user/user_balance_detail`,
    baseURL: '/api',
    method: 'post',
    data
  })
}